<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>模板文件管理</title>
<style type="text/css">
body{
  font-size:12px;
}
.treeview, .treeview ul { 
	padding: 0;
	margin: 0;
	list-style: none;
}

.treeview ul {
	background-color: white;
	margin-top: 4px;
}

.treeview .hitarea {
	background: url(__PUBLIC__/Js/treeview/images/treeview-default.gif) -64px -25px no-repeat;
	height: 16px;
	width: 16px;
	margin-left: -16px;
	float: left;
	cursor: pointer;
}
/* fix for IE6 */
* html .hitarea {
	display: inline;
	float:none;
}

.treeview li { 
	margin: 0;
	padding: 3px 0pt 3px 16px;
}

.treeview a.selected {
	background-color: #eee;
}

#treecontrol { margin: 1em 0; display: none; }

.treeview .hover { color: red; cursor: pointer; }

.treeview li { background: url(__PUBLIC__/Js/treeview/images/treeview-default-line.gif) 0 0 no-repeat; }
.treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; }

.treeview .expandable-hitarea { background-position: -80px -3px; }

.treeview li.last { background-position: 0 -1766px }
.treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(__PUBLIC__/Js/treeview/images/treeview-default.gif); }  
.treeview li.lastCollapsable { background-position: 0 -111px }
.treeview li.lastExpandable { background-position: -32px -67px }

.treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; }

.treeview-red li { background-image: url(__PUBLIC__/Js/treeview/images/treeview-red-line.gif); }
.treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(__PUBLIC__/Js/treeview/images/treeview-red.gif); } 

.treeview-black li { background-image: url(__PUBLIC__/Js/treeview/images/treeview-black-line.gif); }
.treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(__PUBLIC__/Js/treeview/images/treeview-black.gif); }  

.treeview-gray li { background-image: url(__PUBLIC__/Js/treeview/images/treeview-gray-line.gif); }
.treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(__PUBLIC__/Js/treeview/images/treeview-gray.gif); } 

.treeview-famfamfam li { background-image: url(__PUBLIC__/Js/treeview/images/treeview-famfamfam-line.gif); }
.treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(__PUBLIC__/Js/treeview/images/treeview-famfamfam.gif); } 


.filetree li { padding: 3px 0 2px 16px; }
.filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; }
.filetree span.folder { background: url(__PUBLIC__/Js/treeview/images/folder.gif) 0 0 no-repeat; }
.filetree li.expandable span.folder { background: url(__PUBLIC__/Js/treeview/images/folder-closed.gif) 0 0 no-repeat; }
.filetree span.file { background: url(__PUBLIC__/Js/treeview/images/file.gif) 0 0 no-repeat; }
</style>

<load href="__PUBLIC__/Js/jquery.js"/>
<load href="__PUBLIC__/Js/treeview/jquery.treeview.js"/>
<script>
$(function(){
  $("#browser").treeview();
  $(".file").bind("click",function(event){
      lookcode($(this).attr("encode_path"));
	  $("#filename").text($(this).text());
	  $("#hidden_filename").val($(this).text());
  });
  var lookcode=function(path){
    $.ajax({
	   type:"GET",
	   cache:false,
	   async:true,
	   dataType:"text",
	   data:"path="+path,
	   url:"__URL__/lookcode",
	   success:function(msg){
		 if(msg=="文件不存在"){
		   alert(msg);
		   return false;
		 }else{
		   $("#code_content").val(msg);
		 }
	   },
	   error:function(){
	     alert('出现错误');
	   }
	}); 
  }
  $("#btn1").click(function(){
      if($("#hidden_filename").val()==""){
	      alert("请选择你要修改的模板文件");
		  return false;
	  }
	  $("#form1").submit();
	  $(this).attr("disabled",true);
  });
  
});
 
</script>
</head>
<body>
<!-- layout::Admin:Syscolumn:inc_top::0 -->
修改模板文件之前，请确保具有模板文件写权限
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<form id="form1" name="form1" method="post" action="__URL__/savecode/type/tpl">
  <tr>
    <td width="400px;" rowspan="2" align="left" valign="top"><php>
      echo "<ul id='browser' class='filetree'>";
        show_dir($dir_list);
        echo "</ul>";
    </php></td>
	
    <td align="center" valign="top">
      文件名:<span id="filename"></span>
      <input name="btn1" type="button" id="btn1" value="保存" />
	  <input name="hidden_filename" id="hidden_filename" type="hidden"/>
    </span></td>
  </tr>
  <tr>
    <td width="600px;" align="left" valign="top"><textarea name="code_content" cols="70" rows="20" id="code_content"></textarea></td>
  </tr>
  </form>
</table>


</body>
</html>
